import os

GMOCK_DIR="/workspace/cpp/googletest/googlemock"
GTEST_DIR="/workspace/cpp/googletest/googletest"


LIB_PATH = ['/usr/lib', '/usr/local/lib', '/usr/local/opt/openssl/lib', './lib', './bin','/usr/lib/x86_64-linux-gnu']

env = Environment()
env.Append(CPPPATH=["/usr/local/include", GMOCK_DIR + "/include", 
    GTEST_DIR + "/include", "./inc", "./src", "./lib", "./com/algorithms"] )
env.Append(CCFLAGS = '-Wall -g -O1 -static -std=c++11 ')
env.Append(LIBPATH=["/usr/local/lib", "./lib/googlemock", "./lib/googlemock/gtest"])

basictest=env.Program(target='./bin/function_ptr_test', source=['./test/function_ptr_test.cpp'])

tinydiagram=env.Program(target='./bin/tiny_diagram', source=['./exam/tiny_diagram.cpp'])


#algotest=env.Program(target='./bin/HuffmanCodeTest', source=['./com/algorithms/HuffmanCode.cpp'], CCFLAGS = '-Wall -g -O1 -static -std=c++11 -D_TEST_HUFFMAN_CODE_=1')

unittest=env.Program(target='./bin/unittest', source=['./test/unittest.cpp', 
	'./test/basictest.cpp', 
    './test/functortest.cpp', 
	'./test/stltest.cpp', 
    './test/StringUtilTest.cpp', 
    './test/jsoncpp_test.cpp', 
    './test/RegexTest.cpp', 
    './src/TestCase.cpp',
    './src/StringUtil.cpp',
    './test/TestSuiteLoaderTest.cpp',
    './test/HuffmanCodeTest.cpp',
    './test/TimeFuncTest.cpp',
    './test/future_test.cpp',
	'./test/smart_ptr_test.cpp'],
	CCFLAGS='-fno-elide-constructors -Wall -g -O1 -static -std=c++11 -DBOOST_LOG_DYN_LINK',
    LIBS = ['gmock','gtest', 'jsoncpp', 'pthread'], LIBPATH = LIB_PATH)

boosttest=env.Program(target='./bin/boosttest', 
    source=['./test/unittest.cpp', './test/boosttest.cpp'],
	CCFLAGS='-fno-elide-constructors -Wall -g -O1 -static -std=c++11 -DBOOST_LOG_DYN_LINK',
    LIBS = ['gmock','gtest', 'jsoncpp', 'pthread','boost_log','boost_thread'], 
    LIBPATH = LIB_PATH )

wordbankdemo=env.Program(target='./bin/wordbankdemo', 
    source=['./exam/WordBankDemo.cpp', './src/WordBank.cpp'],
	CCFLAGS='-fno-elide-constructors -Wall -g -O1 -static -std=c++17 -DBOOST_LOG_DYN_LINK -pg',
    LINKFLAGS='-pg',
    LIBS = ['boost_log','boost_timer'], 
    LIBPATH = LIB_PATH )    

text2image=env.Program(target='./bin/text2image', source=['./src/text2image.cpp'], 
	LINKFLAGS='-lgd -lpng -lz -ljpeg -lfreetype -lm')

run_example=env.Program(target='./bin/run_example', source=[
    './exam/run_example.cpp', './exam/boost_function.cpp', './exam/boost_memory.cpp', './exam/cpp11_lambda.cpp'], 
    CCFLAGS='-fno-elide-constructors -Wall -g -O1 -static -std=c++11 -DBOOST_LOG_DYN_LINK',
    LIBS = ['jsoncpp', 'pthread','boost_log','boost_thread', 'boost_program_options'], 
    LIBPATH = LIB_PATH)

waltertest=env.Program(target='./bin/waltertest', source=['./test/waltertest.cpp', 
        './src/showbytes.cpp', './src/FileUtil.cpp',
        './src/StringUtil.cpp',
        './src/NetworkUtil.cpp'], 
    CCFLAGS='-fno-elide-constructors -Wall -g -O1 -static -std=c++11 -DBOOST_LOG_DYN_LINK',    
    LINKFLAGS='-lm')

#, LIBS = ['gmock', 'gtest'], LIBPATH = ['./bin', GMOCK_DIR + "/lib/.libs", GTEST_DIR + "/lib/.libs" ])
#Default(basic_test)
Default(waltertest, 
    basictest, 
    unittest,
    boosttest,
    run_example,
    wordbankdemo)

